import java.util.Arrays;

public class Mystack {
    private int[] elem;
    private int usedsize;
    private static final int big = 10;

    public Mystack {
        elem = new int[big];
    }

    public void push(int val) {
        if(isfull()) {
            grow();
        }
        elem[usedsize] = val;
        usedsize++;
    }

    public int pop() {
        if(usedsize == 0) {
            throw new IndexOutOfBoundsException("");
        }
        usedsize--;
        return elem[usedsize];
    }

    public int peek() {
        if(usedsize == 0) {
            throw new IndexOutOfBoundsException("");
        }
        return elem[usedsize-1];
    }




    public boolean  isfull() {
        return usedsize == 0;
    }

    public void grow() {
        elem = Arrays.copyOf(elem,elem.length*2)
    }
}
public class Test2 {

}
